package com.contract.spirit.ui.main.first

import androidx.lifecycle.MutableLiveData
import com.contract.commonlib.base.BaseViewModel
import com.contract.commonlib.http.ext.request
import com.contract.commonlib.http.status.ResultState
import com.contract.spirit.bean.entity.BannerInfo
import com.contract.spirit.bean.response.MainPageResponse
import com.contract.spirit.func.net.rxApi

/**
 * @author: witness
 * created: 2021/9/17
 * desc:
 */
class MainFirstViewModel : BaseViewModel() {
    val mainPageResponse = MutableLiveData<ResultState<MainPageResponse>>()
    val bannerInfo = MutableLiveData<ResultState<List<BannerInfo>>>()
    fun getFirstIndexInfo() {
        request({ rxApi.getMainPageInfo() }, mainPageResponse, mainPageResponse.value == null)
    }

    fun getBannerList() {
        request({ rxApi.getBannerList() }, bannerInfo, false)
    }
}